from PyQt5.QtWidgets import QApplication,QWidget,QLabel,QLineEdit,QTextEdit,QVBoxLayout,QRadioButton
from PyQt5.QtWidgets import QPushButton,QHBoxLayout,QFormLayout,QMessageBox,QInputDialog,QColorDialog
from PyQt5.QtWidgets import QButtonGroup
from PyQt5.QtGui import QIcon,QPixmap
import sys
def task(btn:QRadioButton):
    print(btn.text(),btn.isChecked())
    pass
if __name__ == "__main__":
    # 创建QApplication对象
    app=QApplication(sys.argv)
    #创建窗口
    window=QWidget()
    #命名窗口
    window.setWindowTitle("对话框")
    #指定图标
    window.setWindowIcon(QIcon("gege.png"))
    #设置窗口大小
    window.resize(1000, 800)
    #——————————————————————————————————————组件初始化
    root_layout = QVBoxLayout(window)
    btn=QRadioButton("男")
    btn1=QRadioButton("女")
    btn1.setChecked(True)
    #设置垂直间距
    #把
    group=QButtonGroup()
    group.addButton(btn1)
    group.addButton(btn)
    group.buttonToggled.connect(task)
    btn1.clicked.connect(lambda:print("click"))
    
    root_layout.addWidget(btn)
    root_layout.addSpacing(20)  # 这里添加了20像素的垂直间距
    root_layout.addWidget(btn1)
    # window.setLayout(root_layout)

    #_____________________________________
    #显示窗口
    window.show()
    #鼠标悬浮文字
    window.setToolTip("你好")
    #结束
    sys.exit(app.exec_())
    